{template 'header', $module}
<div class="main-block bd-gray mt10">
	<div class="hd fn-clear">
		<h2 class="fn-left">加入收藏</h2>
	</div>
	<ul id="data-nav" class="main-nav mt10 fn-clear">
		<li id="status_1"><a href="favorite.php?action=add&status=1">添加收藏</a></li>
		<li id="status_"><a href="favorite.php">我的收藏</a></li>
		<li id="status_2"><a href="type.php?item=favorite&status=2">收藏分类</a></li>
	</ul>
{if $action == 'add'}
<form method="post" action="favorite.php" id="pub-form">
	<input type="hidden" name="action" value="{$action}"/>
	<table class="data-form">
		<tr>
			<th width="90">分类</th>
			<td class="tr">{$type_select}&nbsp; <a href="type.php?item=favorite&status=2" class="t">[管理分类]</a></td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 标题</th>
			<td class="tr"><input type="text" size="45" name="post[title]" class="graybd-ipt easyui-validatebox" data-options="required:true,missingMessage:'请输入标题'" value="{$title}"/></td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 网址</th>
			<td class="tr"><input type="text" size="60" name="post[url]" id="url" value="{$url}" class="graybd-ipt easyui-validatebox" data-options="required:true,missingMessage:'请输入网址'" /> <span id="durl" class="cred"></span></td>
		</tr>
		<tr>
			<th width="90">备注</th>
			<td class="tr"><input type="text" size="60" name="post[note]" id="note"/></td>
		</tr>
		<tr>
			<th width="90"></th>
			<td class="tr" height="50"><input type="submit" name="submit" value=" 确 定 " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" 重 置 " class="btn"/></td>
		</tr>
	</table>
</form>
	{elseif $action == 'edit'}
<form method="post" action="favorite.php" id="pub-form">
	<input type="hidden" name="action" value="{$action}"/>
	<input type="hidden" name="itemid" value="{$itemid}"/>
	<input type="hidden" name="forward" value="{$forward}"/>
	<table class="data-form">
		<tr>
			<th width="90">分类</th>
			<td class="tr">{$type_select}&nbsp; <a href="type.php?item=favorite" class="t">[管理分类]</a></td>
		</tr>
		<tr>
			<th width="90">显示顺序</th>
			<td class="tr f_gray"><input type="text" size="3" name="post[listorder]" id="listorder" value="{$listorder}"/> 请填写数字，数字越大越靠前</td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 标题</th>
			<td class="tr"><input type="text" size="45" name="post[title]" id="title" value="{$title}" class="graybd-ipt easyui-validatebox" data-options="required:true,missingMessage:'请输入标题'"/></td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 网址</th>
			<td class="tr"><input type="text" size="60" name="post[url]" id="url" value="{$url}" class="graybd-ipt easyui-validatebox" data-options="required:true,missingMessage:'请输入网址'"/></td>
		</tr>
		<tr>
			<th width="90">备注</th>
			<td class="tr"><input type="text" size="60" name="post[note]" id="note" value="{$note}"/></td>
		</tr>
		<tr>
			<th width="90">&nbsp;</th>
			<td class="tr" height="50"><input type="submit" name="submit" value=" 修 改 " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" 返 回 " class="btn" onclick="history.back(-1);"/></td>
		</tr>
	</table>
</form>
	{else}
	<div class="filter con fn-clear">
		<form action="favorite.php">
			<p class="fn-left mr10">{$fields_select}</p>
			<p class="fn-left mr10">{$type_select}</p>
			<input class="fn-left mr10" type="text" name="kw" value="{$kw}" title="关键词" size='60'/>
			<button class="btn fn-left mr20" type="submit">搜索</button>
			<button class="btn fn-left" type="reset" onclick="window.location='favorite.php';">重置</button>
		</form>
	</div>
	<table class="filter-tb mt10 c000 con">
		<tr>
			<th width="150">分类</th>
			<th width="300">
				<label class="fn-left" for="sel-all">标 题</label>
			</th>
			<th width="150">添加时间</th>
			<th width="80">管理</th>
		</tr>
		{loop $lists $k $v}
			<tr title="备注:{$v[note]}">
				<td>&nbsp;<a href="favorite.php?typeid={$v[typeid]}">{$v[type]}</a>&nbsp;</td>
				<td align="left">&nbsp;<a href="{$v[url]}" target="_blank" class="t">{$v[title]}</a></td>
				<td class="f_gray px11">{$v[adddate]}</td>
				<td class="pub-oper">
					<a class="edit" href="favorite.php?action=edit&itemid={$v[itemid]}" title='修改'></a>&nbsp;
					<a class="del" href="favorite.php?action=delete&itemid={$v[itemid]}" onclick="return confirm('确定要删除吗？此操作将不可撤销');"  title='删除'></a>
				</td>
			</tr>
		{/loop}
	</table>
	{if $MG[favorite_limit]}
	<div class="con">收藏夹容量 <span class="f_b cred">{$MG[favorite_limit]}</span> 条&nbsp;&nbsp;&nbsp;当前已收藏 <span class="f_b">{$limit_used}</span> 条&nbsp;&nbsp;&nbsp;还可以收藏 <span class="f_b f_blue">{$limit_free}</span> 条</div>
	{/if}
<div class="pages">{$pages}</div>
{/if}
<script type="text/javascript">
    seajs.use(['member'], function(member){
	    $('#pub-form').on('submit', function(){
		    return $('#pub-form').form('validate');
	    });
        member.active('menu_general', 'favorite', 'status_{$status}')
    });
</script>
</div>
{template 'footer', $module}